# -*- coding:utf-8 -*-
# Author:Ami
# @Time    : 2018/12/1 9:31


class Dog(object):
    def __init__(self, name):
        self.name = name

    def eat(self,food):
        print("%s is eating...%s" % (self.name,food))

def bulk(self):
    print("%s叫" % self.name)
d = Dog("cc")

choice = input(">>:").strip()

# print(hasattr(d,choice))
# print(getattr(d,choice))
if hasattr(d,choice): #是否存在
    delattr(d,choice) #删除
    # func = getattr(d,choice) #运行 获取
    # func('包子')
else:
    # setattr(d,choice,bulk)
    # d.talk(d)
    setattr(d,choice,22)#设置
    print(getattr(d,choice))